define(function(require,exports,module){
    var Grid = require("grid");

    module.exports = {
        initComponent: function(widget){
            var grid = new Grid({
                parentNode: ".J-grid",
                model: {
                    url: "api/productruledetail/query",
                    params: function(){
                        return {
                            seal:false,
                            fetchProperties: widget.store.getGridFetchProperties()
                        }
                    },
                    isInitPageBar: false,
                    columns : [{
                        name: "productRule.product.name",
                        label: "产品名称"
                    },{
                        name: "productType.name",
                        label: "产品类型"
                    },{
                        name: "productBatch.name",
                        label: "在售批次"
                    },{
                        name: "price",
                        label: "价格（元）"
                    },{
                        name: "operate",
                        label: "操作",
                        format: "button",
                        formatparams: [{
                            id: "edit",
                            icon: "icon-edit",
                            handler: function(index,data,rowEL){
                            	widget.handler.grid.toEdit(widget,data);
                            }
                        }]
                    }]
                }
            });
            widget.set("grid",grid);
        }
    };
});